<template>
<van-cell class="article-item" :to="/article/+article.art_id">
<!--  标题部分-->
  <div slot="title" class="title van-multi-ellipsis--l2">{{article.title}}</div>
<!--  下方作者，评论，发布时间，三张图片时-->
  <div slot="label">
      <div class="cover-warp" v-if="article.cover.type===3">
        <div class="cover-item"
             v-for="(item,index) in article.cover.images"
             :key="index"

        >
          <van-image
            class="cover-item-images"
            fit="cover"
            :src="item"
          />
        </div>

      </div>
    <span class="authorName">{{article.aut_name}}</span>
    <span class="comm_count">{{article.comm_count}}评论</span>
    <span>{{article.pubdate | relativeTime}}</span>
  </div>
<!--只有一张图片时-->
    <van-image
      class="right-cover"
      fit="cover"
      v-if="article.cover.type ===1"
      :src="article.cover.images[0]"/>




</van-cell>
</template>

<script>
export default {
  name: "index",
  props:{
    article:{
      type:Object,
      required:true
    }
  }
}
</script>

<style scoped lang="less">
.article-item{
  .title{
    font-size: 32px;
    color: #3a3a3a;
  }
  .van-cell__value{
    //一张图
    flex: unset;
    width: 232px;
    height: 146px;
  }
  .cover-warp{
    display: flex;

    .cover-item{
      flex: 1;
      height: 146px;
      padding: 30px 0;
      &:not(:last-child){
        padding-right: 4px;
      }
      .cover-item-images{
        width: 100%;
        height: 146px;

      }
    }
  }



  .comm_count{
    margin: 0 20px;
  }


}


</style>
